<template>
  <div>
    <div class="air_ticket">
      <h2 class="inland">
        <span class="iconfont iconfeiji"></span> 国内机票
      </h2>
      <el-row type="flex" justify="space-between">
        <div class="search">
          <searchFrom></searchFrom>
          <!-- <div>搜索</div> -->
        </div>

        <div class="banner">
          <img src="http://157.122.54.189:9093/images/pic_sale.jpeg" alt />
        </div>
      </el-row>
      <!-- 广告 -->
      <el-row class="statement">
        <el-col :span="8">
          <div>
            <span class="iconfont iconweibiaoti-_huabanfuben"></span>
            100%航协认证
          </div>
        </el-col>
        <el-col :span="8">
          <div>
            <span class="iconfont iconbaozheng"></span>
            出行保证
          </div>
        </el-col>
        <el-col :span="8">
          <div>
            <span class="iconfont icondianhua"></span>
            7x24小时服务
          </div>
        </el-col>
      </el-row>
      <h2 class="special">
        <span class="iconfont icontejiajipiao"></span> 特价机票
      </h2>
      <!-- 特价机票 -->
      <el-row :gutter="20" v-if="sale.length>0" justify="space-around" class="sale_main">
        <el-col :span="6" v-for="(item,index) of sale" :key="index">
          <nuxt-link :to="`/air/flights?departCity=${item.departCity}&dsepartCode=${item.dsepartCode}&destCity=${item.destCity}&destCode=${item.destCode}&departDate=${item.departDate}`">
          <div class="sale_item">
            <img :src="item.cover" alt />

            <div class="sale_lower">
              <span class="site">{{item.departCity + '-' +item.destCity}}</span>
              <span class="money">￥{{item.price}}</span>
            </div>
          </div>
             </nuxt-link>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
import searchFrom from "../../components/air/searchFrom";
export default {
  data() {
    return {
      sale: []
    };
  },
  methods: {
    get_sale() {
      this.$axios({
        method: "get",
        url: "/airs/sale"
      }).then(res => {
        const { data } = res.data;
        this.sale = data;
      });
    }
  },
  mounted() {
    this.get_sale();
  },
  components: {
    searchFrom
  }
};
</script>

<style lang="less" scoped>
.air_ticket {
  width: 1000px;
  margin: auto;
  h2 {
    font-size: 20px;
    font-weight: 400;
    padding: 20px 0;
  }
  .inland {
    color: #ffa500;
  }
  .search {
    width: 360px;
    height: 350px;
  }
  .banner {
    width: 620px;
    img {
      width: 100%;
      height: auto;
    }
  }
  .statement {
    margin-top: 15px;
    border: 1px solid #dddddd;
    text-align: center;
    background-color: #f5f5f5;
    padding: 10px 0;
    > div {
      div {
        height: 36px;
        line-height: 36px;
        border-left: 1px solid #dddddd;
        // 字体样式颜色
        .iconweibiaoti-_huabanfuben {
          color: #409ffd;
        }
        .iconbaozheng {
          color: #5f8917;
        }
        .icondianhua {
          color: #409eff;
        }
        span {
          font-size: 28px;
        }
      }
      &:nth-child(1) div {
        border-left: transparent;
      }
    }
  }
  // 特价机票
  .special {
    color: #409eff;
  }
  .sale_main{
    box-sizing: border-box;
    padding: 20px;
    border: 1px solid #dddddd;
  }
  .sale_item {
    width: 220px;
    height: 135px;
    position: relative;
       border: 1px solid #dddddd;
    img {
      width: 100%;
      height: 100%;
    }
    .sale_lower {
      box-sizing: border-box;
      width: 100%;
      padding: 4px 10px;
      position: absolute;
      left: 0;
      bottom: 0;
      // background: #333;
      // opacity: 0.3;
      background-color: rgba(51, 51, 51, 0.3);
      span {
        color: white;
      }
      .money {
        float: right;
      }
      .site {
        float: left;
        font-size: 14px;
      }
    }
  }
}
</style>